<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>

</head>
<body>
    <div id="app">
       <div>
        <button @click="isLogin=true">登录</button>
        <button @click="isLogin=false">注册</button>
       </div>
       <div v-if="isLogin">
            <p>登录</p>
            <!-- 为避免数据重复渲染，可以添加key进行区分 -->
            账号<input type="text" key="login1">
            密码<input type="text" key="login2">
       </div>
       <div v-else>
            <p>注册</p>
            账号<input type="text">
            密码<input type="text">
            邮箱<input type="text">
       </div>
    </div>
    <script>
        Vue.config.productionTip = false;
        const vm = new Vue({
            el:'#app',
            data(){
                return {
                    isLogin:true
                }
            }
        })

    </script>
</body>
</html>